<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum=1, user-scalable=no, shrik-to-fit=to">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    body{
        margin: 0;
        padding: 0;
    }
</style>

</head>
<body>
  <div id="video-container" style="margin: 0px auto;">

  </div>
  <!--[if lt IE 9]>
  <script src="//imgcache.qq.com/open/qcloud/video/vcplayer/libs/es5-shim.js"></script>
  <script src="//imgcache.qq.com/open/qcloud/video/vcplayer/libs/es5-sham.js"></script>
  <![endif]-->
  <script src="//imgcache.qq.com/open/qcloud/video/vcplayer/TcPlayer-2.2.2.js"></script>
  <script>
      (function(){
          function getParams(name) {
              var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
              var r = window.location.search.substr(1).match(reg);
              if (r != null) {
                  return decodeURIComponent(r[2]);
              }
              return null;
          }
          var rtmp = getParams('rtmp'),
              flv  = getParams('flv') ||　'http://2000.liveplay.myqcloud.com/live/2000_a087c9da44ea11e6a2cba4dcbef5e35a.flv',
              m3u8 = getParams('m3u8'),
              mp4  = getParams('mp4'),
              live = (getParams('live') == 'true' ? true : false),
              coverpic = getParams('coverpic'),
              width = getParams('width'),
              height = getParams('height'),
              volume = getParams('volume'),
              flash = (getParams('flash') == 'true' ? true : false),
              h5_flv =  (getParams('h5_flv') == 'true' ? true : false),
              autoplay = (getParams('autoplay') == 'true' ? true : false),
              log = getParams('log');

           /**
           * 视频类型播放优先级
           * mobile ：m3u8>mp4
           * PC ：RTMP>flv>m3u8>mp4
           */

          var options = {
              mp4 :'http://p2.weizan.cn/776996/131886368800040810/live.m3u8',
              mp4_hd :'//1256993030.vod2.myqcloud.com/d520582dvodtransgzp1256993030/7732bd367447398157015849771/v.f30.mp4',
              mp4_sd : '//1256993030.vod2.myqcloud.com/d520582dvodtransgzp1256993030/7732bd367447398157015849771/v.f20.mp4',
              clarity: 'od',
              clarityLabel:{
                  od: '原画',
                  hd: '高清',
                  sd: '标清'
              },
              coverpic: coverpic ,
              autoplay: autoplay ? true : false,
              live: live,
              width : width || '480',
              height : height || '320',
              volume : volume || 0.5,
              flash : flash,
              h5_flv: h5_flv,
              listener: function (msg) {
                  if(!log){
                      return;
                  }
                  if(msg.type!='timeupdate'){
                      console.log(msg);
                  }
              }
          };
          var player = new TcPlayer('video-container', options);
          window.tcplayer  = player;
      })();
  </script>

</body>
</html>
